home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac: Not for Sale
/
Another.not.for.sale (Australia).iso
/
fade into you
/
getting there
/
Apps
/
MOO-1.7.6.src
/
inc
/
db.h
< prev
next >
Wrap
Text File
|
1994-11-02
|
9KB
|
222 lines
/******************************************************************************
Copyright (c) 1992 Xerox Corporation. All rights reserved.
Portions of this code were written by Stephen White, aka ghond.
Use and copying of this software and preparation of derivative works based
upon this software are permitted. Any distribution of this software or
derivative works must comply with all applicable United States export
control laws. This software is made available AS IS, and Xerox Corporation
makes no warranty about the software, its performance or its conformity to
any specification. Any person obtaining a copy of this software is requested
to send their name and post office or electronic mail address to:
Pavel Curtis
Xerox PARC
3333 Coyote Hill Rd.
Palo Alto, CA 94304
Pavel@Xerox.Com
*****************************************************************************/
#include "config.h"
#include "structures.h"
/**** db ****/
extern int in_child;
enum flush_type {FLUSH_IF_FULL, FLUSH_ONE_SECOND, FLUSH_ALL_NOW, FLUSH_PANIC};
int db_init(const char *, const char *);
/* (in , out) returns 0 in normal case, non-zero for error */
int db_flush(enum flush_type);
void db_shutdown();
/**** objects ****/
extern Objid create_object(const char *, Objid, Objid);
/* (name, parent, owner). Creates a new object with parent as its */
/* immediate ancestor. Returns new objects' id number */
extern void destroy_object(Objid);
/* (object). Destroy object, and frees prop vals,
verbdefs, etc */
extern Var do_change_parent(Objid, Objid);
/* (object, parent) */
extern Var change_parent(Objid, Objid, Objid);
/* ( object, parent, progr ) Changes object's parent to be parent, */
/* checking permissions and fixing properties as necessary */
extern Objid renumber_object(Objid);
/* (object) renumber object to be ne lowest
free object number. Returns new id number */
extern int obj_perm(Objid, Objid, int);
/* (player, object, action) */
/* checks if player can do a particular action on object. */
extern void add_child(Objid /*parent*/, Objid /*new child*/);
extern void remove_child(Objid /*parent*/, Objid /*child*/);
extern void add_content(Objid /*location*/, Objid /*new content*/);
extern void remove_content(Objid /*location*/, Objid /*content*/);
/* - querying object values - */
extern int valid(Objid); /* returns if Objid exists */
extern Objid obj_owner(Objid); /* returns the owner of Objid */
extern const char *obj_name(Objid); /* returns the name of Objid */
extern Objid obj_location(Objid); /* returns the location of Objid */
extern Objid obj_parent(Objid); /* returns the parent of Objid */
extern Objid obj_child(Objid); /* returns the first child of Objid */
extern Objid obj_sibling(Objid); /* returns the next sibling of Objid */
extern Objid obj_contents(Objid); /* returns first 'content' object */
extern Objid obj_next_content(Objid); /* returns next object in
content list after Objid */
extern int obj_flags(Objid); /* returns the flags for Objid */
/* - setting object values - */
extern void set_obj_owner(Objid, Objid); /* sets the owner */
extern void set_obj_name(Objid, const char *); /* sets the name */
extern void set_obj_location(Objid, Objid); /* sets the location */
extern void set_obj_parent(Objid, Objid); /* sets the parent */
extern void set_obj_child(Objid, Objid); /* sets the child list */
extern void set_obj_sibling(Objid, Objid); /* sets its sibling */
extern void set_obj_contents(Objid, Objid); /* sets the first content */
extern void set_obj_next_content(Objid, Objid); /* sets the next in the
content list */
extern void set_obj_flags(Objid, int); /* sets the flags */
/**** properties *****/
extern Var get_property_list(Objid, Objid);
/* ( object, programmer ) */
/* returns list of properties defined on object in value, if allowed */
extern int has_property(Objid, const char *, Objid);
/* ( object, prop-name, programmer ) */
/* if programmer is allowed to check, */
/*returns 1 if object has prop-name, 0 otherwise */
extern enum error get_prop_val (Objid, const char *, Var *, Objid, int);
/* ( object, prop_name, &Value, programmer, keep_clear) */
extern enum error get_non_bi_prop(Objid, const char *, Var *, int);
extern enum error get_prop_safe (Objid, const char *, Var *, int);
/* ( object, prop_name, &Value, keep_clear ) -- safe, so no progr */
/* fills in the value of the property requested, checking permissions in */
/* first instance, not in other two. */
/* if keep_clear is true, parent lookup will not be done for TYPE_CLEAR */
/* properties. */
extern enum error set_prop_val(Objid, const char *, Var, Objid);
/* ( object, prop_name, value, programmer) */
extern enum error set_prop_safe(Objid, const char *, Var);
/* ( object, prop_name, value ) */
/* sets the value of the property specified, checking permissions in */
/* the first instance */
extern unsigned int str_hash(const char *);
extern Propdef new_propdef(const char *);
extern enum error add_property(Objid, const char *, Objid, Var, Var);
/* ( object, prop-name, programmer, value, info ) */
/* Add property name to object with value, owner and permissions. */
extern enum error delete_property(Objid, const char *, Objid);
/* ( object, prop-name, programmer ) */
/* remove prop-name from object */
extern enum error set_prop_info(Objid, const char *, Objid, Var);
/* ( object, prop-name, programmer, info ) */
/* set the property owner and permissions */
extern Var get_prop_info(Objid, const char *, Objid);
/* ( object, prop-name, programmer ) */
/* return the property owner and permission */
/**** verbs ****/
extern Var get_verb_list(Objid, Objid);
/* (object, programmer ) */
/* returns list of verb names on an object */
extern enum error has_verb(Objid, const char *, Objid, int *);
/* ( object, verb-name, programmer, &answer ) */
/* checks if object has a verb with the name verb-name specifies */
extern enum error add_verb(Objid, Objid, Var, Var);
/* ( object, programmer, info, args ); */
/* checks permissions, and if allowed, */
/* adds object:verb-name with verb info and args set */
extern enum error delete_verb(Objid, const char *, Objid);
/* ( object, verb-name, programmer ) */
/* checks permissions, and if allowed */
/* deletes object:verb-name */
extern enum error get_verb_code(Objid, const char *, Objid, Var *, int, int);
/* ( object, verb-name, programmer, &value, parens, indent ) */
/* returns verb code in value, if allowed */
extern Var set_verb_code(Objid, const char *, Objid, Var);
/* ( object, verb-name, programmer, value ) */
/* sets verb code from value, if allowed */
extern Var get_verb_info(Objid, const char *, Objid);
/* ( object, verb-name, programmer ) */
/* returns the information about object:verb-name, after check permissions */
extern enum error set_verb_info(Objid, const char *, Objid, Var);
/* ( object, verb-name, programmer, value ) */
/* sets the verb-info object:verb-name to info out of value, after */
/* checking permissions */
extern Var get_verb_args(Objid, const char *, Objid);
/* ( object, verb-name, programmer, &value ) */
/* returns verb arguments in value, if allowed */
extern enum error set_verb_args(Objid, const char *, Objid, Var);
/* ( object, verb-name, programmer, value ) */
/* sets verb args from value, if allowed */
extern Program *get_program_and_pi(Objid, const char *, Parse_Info *, int);
/* ( object, verb-name, pi to fill in, match_options ) */
/* Note: A verbdef_info is not guaranteed to be valid for
very long after it is returned. Retrieve the information
needed, and then don't use the handle any more. */
typedef struct verbdef_info {
void *ptr;
Objid vloc;
} verbdef_info;
extern verbdef_info get_verbdef_info(Objid, const char *);
/* ( object, verb-name ) */
/* get the information about a verb */
extern verbdef_info verbdef_info_from_num(Objid, int);
/* ( object, verb-num ) */
extern int verb_exists(verbdef_info);
extern Program *program_from_info(verbdef_info);
extern void set_program_in_info(verbdef_info, Program *);
extern const char *name_from_info(verbdef_info);
extern Objid owner_from_info(verbdef_info);
extern int perms_from_info(verbdef_info);
typedef struct verbref_info {
int verbnum;
Objid oid;
void *ptr;
} verbref_info;
extern verbref_info get_verbref_info(Objid, const char *);
/* ( player, "obj:verbname" ) */
extern int check_verbref_perms(verbref_info, Objid);
/* 1 = good permissions */
extern const char *verbref_name(verbref_info);
/* return the name of the verb in the verbref */